<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 
			<title>Головна / two-books.net</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="description" content="two-books.net - Які твої дві найкращі книги?" />
    <meta name="keywords" content="Найкращі книги, топ книги, twobooks, two-books, книга, література, книжковий, books" />
	<link rel="stylesheet" type="text/css" href="/design/css/styles.css" ></link> 
    
    <script type="text/javascript" src="/design/js/jquery.js"></script>
    

    <script type='text/javascript' src='http://view.jquery.com/trunk/plugins/autocomplete/jquery.autocomplete.js'></script>
    <link rel="stylesheet" type="text/css" href="http://view.jquery.com/trunk/plugins/autocomplete/jquery.autocomplete.css" />

    <!--
    
	<script type="text/javascript" src="/design/js/jquery.autocomplete.js"></script>
	<link rel="stylesheet" type="text/css" href="/design/css/jquery.autocomplete.css" ></link> 
	-->
	
</head><body> 
<script type='text/javascript' 
        src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>

<input type="hidden" id="book_title_check1" name="book_title_check[1]" />
									
										<label>
											<strong>1.</strong> Назва книги <span>*</span><br />
				
											<input type="text" class="text" id="book_title1" name="book_title[1]" />
											<em>Після введення 2-х символів з'явиться підказка </em>
											
										</label>

										
		<p>
			<label>Tags (local):</label>
			<input type="text" id='tags' />
			<input type="button" value="Get Value" />
		</p>
		<p>
			<label>Tags (remote):</label>
			<input type="text" id='tags1' />
			<input type="button" value="Get Value" />
		</p>
														
									
<script type="text/javascript" >

	$().ready(function() {

 		$("#tags1").autocomplete('/exec/tags.php', {
			width: 230,
			multiple: true,
			matchContains: true
		});
	// autocomplete books
			$("#book_title1, #book_title2").autocomplete('/exec/autocomplete.php', {
				minChars: 2,
				width: 230,
			    extraParams: {
				   type:'books'
			    },
				formatItem: function(row, i, max) {
				
					if (row[0].split('~')[2]!='')
						return row[0].split('~')[0]+' ('+row[0].split('~')[2]+')';
					else
						return row[0].split('~')[0];
				},
				formatResult: function(row) {
				  
					//console.log('%o',row)
					return row[0].split('~')[0]
				}
			}).result(function(event, row) {
				
				var author_num = $(this).attr('id').replace(/book_title/,'');
				if (row[0].split('~')[2]!='')
				{
					if (row[0].split('~')[1]!='')
						$('#book_title_id'+author_num).val(row[0].split('~')[1]);
					$('#book_title_check'+author_num).val($(this).val());
					if (row[0].split('~')[3]!='')
					{
						$('#author_id'+author_num).val(row[0].split('~')[3]);
						$('#author'+author_num).val(row[0].split('~')[2]);
						$('#author_check'+author_num).val(row[0].split('~')[2]);
					}
					if (author_num==1)
						$('#book_title2').focus();
				}
				else
				{
					if (row[0].split('~')[1]!='')
					{
						$('#book_title_id'+author_num).val(row[0].split('~')[1]);
					}
					$('#book_title_check'+author_num).val($(this).val());
					$('#author'+author_num).focus();
				}
			});
			
				$("#tags").autocomplete(["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"], {
			width: 320,
			max: 4,
			highlight: false,
			multiple: true,
			multipleSeparator: " ",
			scroll: true,
			scrollHeight: 300
		});
		
	});
	
	</script>
</body>
</html>
